package com.ruoyi.common.enums;

import lombok.Getter;

import java.util.Arrays;

@Getter
public enum ArmingStatusEnum {
    UNKNOWN("999", "未知"),
    /**
     * 00
     */
    ARMING_STATUS_00("00", "撤防状态"),
    /**
     *  01
     */
    ARMING_STATUS_01("01", "外出布防(普通布防最常用)"),
    /**
     * 02
     */
    ARMING_STATUS_02("02", "即时布防(所有防区没有延时)"),
    /**
     * 04
     */
    ARMING_STATUS_04("04", "在家布防(留守布防有些防区可能是在旁路状态)"),
    /**
     * 08
     */
    ARMING_STATUS_08("08", "即时留守布防(有些防区可能旁路,但是没有旁路防区没有延时)"),
    /**
     * 09
     */
    ARMING_STATUS_09("09", "部分防区布防部分防区撤防"),;

    private String code;
    private String desc;

    public void setCode(String code) {
        this.code = code;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    ArmingStatusEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ArmingStatusEnum valueOfCode(String code) {
        return Arrays.stream(values()).filter(status -> status.getCode().equals(code)).findFirst().orElse(UNKNOWN);
    }
}
